package basic50.tenth;

import java.util.Scanner;

public class Basic6 {
    public static void main(String[] args) {
       /* 题目：输入两个正整数m和n，求其最大公约数和最小公倍数。
        程序分析：利用辗除法。*/
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        int maxNumber = maxNumber(m,n);
        System.out.println("最大公约数 " + maxNumber);
        int minNumber = m*n / maxNumber;
        System.out.println("最小公倍数 " + minNumber);
    }

    private static int maxNumber(int m, int n) {
        while (n != 0){
            int temp = m % n;
            m = n;
            n = temp;
        }
        return m;
    }
}
